//package com.example.robot;
//
//import com.enmoli.activity.component.dashboard.bean.PriceForUser;
//import com.enmoli.activity.component.dashboard.bean.RoomPosterCustom;
//import com.enmoli.activity.component.dashboard.bean.catdog.CatDogPK;
//import com.enmoli.activity.component.dashboard.bean.consumed.ConsumedGift;
//import com.enmoli.activity.component.dashboard.bean.summary.SummaryGradeDetail;
//import com.enmoli.activity.component.dashboard.bean.summary.SummaryPK;
//import com.enmoli.activity.component.dashboard.bean.summary.SummaryPKDetail;
//import com.enmoli.activity.component.dashboard.bean.summary.SummaryWinDetail;
//import com.enmoli.activity.component.dashboard.bean.user.BlackWhiteUsers;
//import com.enmoli.activity.component.dashboard.bean.user.UserDetail;
//import com.enmoli.activity.component.dashboard.clickhouse.ClickHouseUtils;
//import com.enmoli.activity.component.dashboard.utils.PriceDataUtils;
//import com.enmoli.activity.component.dashboard.utils.SQLUtils;
//import com.enmoli.activity.component.dashboard.utils.SplicingDataUtils;
//import com.enmoli.activity.data.AsAdminActivity;
//import com.enmoli.activity.data.repository.AsAdminActivityRepository;
//import com.enmoli.activity.service.ActivityCallAPIService;
//import com.enmoli.activity.service.ActivityExtraService;
//import com.enmoli.activity.service.RobotMessageService;
//import com.enmoli.activity.utils.TaskUtil;
//import com.enmoli.core.api.cache.CoreMetadataCache;
//import com.enmoli.core.domain.Poster;
//import com.enmoli.core.domain.RoomPoster;
//import com.enmoli.core.util.CollectionUtils;
//import com.enmoli.core.util.DateUtil;
//import com.enmoli.core.util.JsonUtil;
//import com.enmoli.core.util.ObjectUtil;
//import com.enmoli.userservice.api.result.UserLevelOneResultData;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.kafka.common.protocol.types.Field;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import ru.yandex.clickhouse.ClickHousePreparedStatement;
//
//import java.sql.Connection;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//import java.sql.Timestamp;
//import java.text.SimpleDateFormat;
//import java.util.*;
//import java.util.stream.Collectors;
//
//@Service
//public class DashBoardService {
//
//    private static final Logger logger = LoggerFactory.getLogger(DashBoardService.class);
//
//    @Autowired
//    private ClickHouseUtils clickHouseUtils;
//
//    @Autowired
//    private AsAdminActivityRepository activityRepository;
//
//    @Autowired
//    private ActivityCallAPIService apiService;
//
//    @Autowired
//    private ActivityExtraService activityExtraService;
//
//    @Autowired
//    private SQLUtils sqlUtils;
//
//    @Autowired
//    private SplicingDataUtils splicingDataUtils;
//
//    @Autowired
//    private PriceDataUtils priceDataUtils;
//    @Autowired
//    private ActivityLogProperties prop;
//
//    @Autowired
//    private CoreMetadataCache coreMetadataCache;
//
//    @Autowired
//    RobotMessageService robotMessageService;
//
//    /**
//     * 推送每日流水到企微
//     */
//    public void pushRechargeData(){
//
//        String webhook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=406f7243-6a05-48a9-9aae-9d4aed0060dd";
//
//        Connection conn = clickHouseUtils.connection();
//        ResultSet resultSet = null;
//        ClickHousePreparedStatement pst = null;
//
////            List<Object> paramList = new ArrayList<>();
////
////            String sql = "SELECT * from events_db.event_log WHERE eventType = 42 and `timestamp` BETWEEN '2023-08-21 00:00:00' and '2023-08-21 23:59:59';\n";
////            sql = sqlUtils.boundCommonCondition(sql, paramList, activityLogQuery);
////            sql += " group by visitParamExtractInt(detail , 'grade'),visitParamExtractInt(detail , 'isWin')";
////            Object[] params = paramList.toArray();
////            pst = (ClickHousePreparedStatement) conn.prepareStatement(sql);
////            for (int i = 0; i < params.length; i++) {
////                pst.setObject(i + 1, params[i]);
////            }
////            resultSet = pst.executeQuery();
////            List<SummaryPKDetail> summaryPKDetails = new ArrayList<>();
////            while (resultSet.next()) {
////                SummaryPKDetail summaryPKDetail = new SummaryPKDetail();
////                int grade = resultSet.getInt("grade");
////                summaryPKDetail.setGrade(grade);
////                Integer isWin = resultSet.getInt("isWin");
////                summaryPKDetail.setIsWin(isWin);
////                long count = resultSet.getLong("count");
////                summaryPKDetail.setCount((int) count);
////                summaryPKDetails.add(summaryPKDetail);
////            }
//
//
//        Map<String, Object> map = new HashMap<>();
//        map.put("content", "");
//        List<String> list = new ArrayList<>();
//        list.add("all");
//        map.put("mentioned_mobile_list", list);
//        robotMessageService.sendGroupMessage(webhook, map);
//
//    }
//
//    /**
//     * 接口 查询正配置的幅海报
//     */
//    public List onGoingRoomPoster() {
//        List<RoomPosterCustom> roomPosterCustomList = new ArrayList<>();
//
//        List<RoomPoster> roomPosterList = coreMetadataCache.getRoomPosterCache().values().stream()
//                                                           .filter(x -> StringUtils.isBlank(x.getIncludedRooms()) && !prop.excludeRoomPosterSet.contains(x.getId()) && x.getStartDate() < DateUtil.currentDateline() && x.getEndDate() > DateUtil.currentDateline())
//                                                           .sorted(Comparator.comparingInt(RoomPoster::getDisplayOrder)).collect(Collectors.toList());
//
//        List<Poster> posterList = coreMetadataCache.getHomepagePosterCache().values().stream()
//                                                   .filter(x -> x.getStatus() == 1 && x.getStartDate() < DateUtil.currentDateline() && x.getEndDate() > DateUtil.currentDateline())
//                                                   .sorted(Comparator.comparingInt(Poster::getDisplayOrder)).collect(Collectors.toList());
//        for (RoomPoster roomPoster : roomPosterList) {
//            RoomPosterCustom roomPosterCustom = ObjectUtil.copyTo(roomPoster, RoomPosterCustom.class);
//            roomPosterCustom.setBackColor("");
//            for (Poster poster : posterList) {
//                if (poster.getActName().equals(roomPoster.getTitle())) {
//                    roomPosterCustom.setBackColor(poster.getBackColor());
//                    break;
//                }
//            }
//            roomPosterCustomList.add(roomPosterCustom);
//        }
//
//        return roomPosterCustomList;
//    }
//
//    /**
//     * 接口 查询正配置的海报
//     */
//    public List onGoingPoster() {
//        return coreMetadataCache.getHomepagePosterCache().values().stream()
//                                .filter(x -> x.getStatus() == 1 && x.getStartDate() < DateUtil.currentDateline() && x.getEndDate() > DateUtil.currentDateline()
//                                        && !prop.excludePosterSet.contains(x.getId()))
//                                .sorted(Comparator.comparingInt(Poster::getDisplayOrder)).collect(Collectors.toList());
//    }
//
//    /**
//     * 接口 正在进行中的活动
//     */
//    public List onGoingActivity() {
//        List<Map<String, Object>> list = new ArrayList<>();
//        List<AsAdminActivity> onGoingActivities = activityRepository.findOnGoingActivities();
//        for (AsAdminActivity onGoingActivity : onGoingActivities) {
//            Map<String, Object> result = new HashMap<>();
//            Long id = onGoingActivity.getId();
//            if (!prop.excludeAidSet.contains(id)) {
//                result.put("aid", id);
//                result.put("title", onGoingActivity.getTitle());
//                list.add(result);
//            }
//        }
//        return list;
//    }
//
//    /**
//     * 接口 查询某个活动存在的 tag
//     */
//    public List findTagOnGoingActivity(Integer aid) {
//        // 只查询本期或上期活动存在的 tag
//        AsAdminActivity asAdminActivity = activityRepository.findById(aid.longValue()).get();
//        long beginTime = asAdminActivity.getBeginTime().longValue();
//        String beginDate = DateUtil.DATE_SECONDS_TIME_FORMAT.format((beginTime - 24 * 3 * 3600) * 1000);
//
//        long endTime = asAdminActivity.getEndTime().longValue();
//        String endDate = DateUtil.DATE_SECONDS_TIME_FORMAT.format((endTime + 24 * 7 * 3600) * 1000);
//
//        List<Map<String, Object>> list = new ArrayList<>();
//        Connection conn = clickHouseUtils.connection();
//        ResultSet resultSet = null;
//        ClickHousePreparedStatement pst = null;
//        try {
//            String sql = "select DISTINCT tag from activity_trace_log where activityid = ? and timestamp >= ? and timestamp <= ?";
//            Object[] params = {aid, beginDate, endDate};
//            pst = (ClickHousePreparedStatement) conn.prepareStatement(sql);
//            for (int i = 0; i < params.length; i++) {
//                pst.setObject(i + 1, params[i]);
//            }
//            resultSet = pst.executeQuery();
//            while (resultSet.next()) {
//                Map<String, Object> result = new HashMap<>();
//                String tag = resultSet.getString("tag");
//                String tagDesc = ActivityLogTag.tagDescValue(tag);
//                if (StringUtils.isNotBlank(tagDesc)) {
//                    result.put("tagName", tag);
//                    result.put("tagDesc", tagDesc);
//                    list.add(result);
//                }
//            }
//            if (prop.priceForAidSet.contains(aid)) {
//                Map<String, Object> result = new HashMap<>();
//                result.put("tagName", "PriceFor");
//                result.put("tagDesc", ActivityLogTag.tagDescValue("PriceFor"));
//                list.add(result);
//            }
//            if (prop.summaryForAidSet.contains(aid)) {
//                Map<String, Object> result = new HashMap<>();
//                result.put("tagName", "ActivityPkSummary");
//                result.put("tagDesc", ActivityLogTag.tagDescValue("ActivityPkSummary"));
//                list.add(result);
//            }
//            if (prop.catDogAid.equals(aid)) {
//                Map<String, Object> result = new HashMap<>();
//                result.put("tagName", "CatDogPKDetail");
//                result.put("tagDesc", ActivityLogTag.tagDescValue("CatDogPKDetail"));
//                list.add(result);
//            }
//        } catch (SQLException e) {
//            logger.error("DashBoardService findTagOnGoingActivity errMsg={}", e.getMessage());
//        } finally {
//            clickHouseUtils.close(pst, resultSet, conn);
//        }
//        return list;
//    }
//
//    /**
//     * 接口 根据 tag、uid、showId 等拼接后 查询具体详情 总条数
//     */
//    public Integer countActivityLogDetail(ActivityLogQuery activityLogQuery) {
//        Connection conn = clickHouseUtils.connection();
//        int total = 0;
//        ResultSet resultSet = null;
//        ClickHousePreparedStatement pst = null;
//        try {
//            List<Object> paramList = new ArrayList<>();
//            String sqlCount = "select count(*) as total from activity_trace_log where 1 = 1 ";
//            sqlCount = sqlUtils.boundCommonCondition(sqlCount, paramList, activityLogQuery);
//
//            String tag = activityLogQuery.getTag();
//            if (StringUtils.isNotBlank(tag)) {
//                sqlCount += "and tag like '%" + tag + "%' ";
//            }
//            Integer round = activityLogQuery.getRound();
//            if (round != null) {
//                sqlCount += "and visitParamExtractInt(detail , 'round') = " + round + " ";
//            }
//
//            logger.info("countActivityLogDetail sqlCount={}", sqlCount);
//            logger.info("countActivityLogDetail params={}", JsonUtil.toJson(paramList));
//
//            Object[] params = paramList.toArray();
//            pst = (ClickHousePreparedStatement) conn.prepareStatement(sqlCount);
//            for (int i = 0; i < params.length; i++) {
//                pst.setObject(i + 1, params[i]);
//            }
//            resultSet = pst.executeQuery();
//            while (resultSet.next()) {
//                total = resultSet.getInt("total");
//            }
//        } catch (SQLException e) {
//            logger.error("DashBoardService countActivityLogDetail errMsg={}", e.getMessage());
//        } finally {
//            clickHouseUtils.close(pst, resultSet, conn);
//        }
//        return total;
//    }
//
//    /**
//     * 接口 根据 tag、uid、showId 等拼接后 查询具体详情 分页
//     */
//    public List<ActivityLogCommonDetail> findActivityLogDetail(ActivityLogQuery activityLogQuery) {
//        List<ActivityLogCommonDetail> list = new ArrayList<>();
//        Connection conn = clickHouseUtils.connection();
//        ResultSet resultSet = null;
//        ClickHousePreparedStatement pst = null;
//        try {
//
//            List<Object> paramList = new ArrayList<>();
//            String sql = "select * from activity_trace_log where 1 = 1 ";
//            sql = sqlUtils.boundCommonCondition(sql, paramList, activityLogQuery);
//            String tagName = activityLogQuery.getTag();
//            if (StringUtils.isNotBlank(tagName)) {
//                sql += "and tag like '%" + tagName + "%' ";
//            }
//            Integer paramRound = activityLogQuery.getRound();
//            if (paramRound != null) {
//                sql += "and visitParamExtractInt(detail , 'round') = " + paramRound + " ";
//            }
//            sql += "order by timestamp desc";
//            Integer pageNum = activityLogQuery.getPageNum();
//            if (pageNum == null) {
//                pageNum = 1;
//            }
//            Integer pageSize = activityLogQuery.getPageSize();
//            if (pageSize == null) {
//                pageSize = 10;
//            }
//            sql += " limit " + (pageNum - 1) * pageSize + "," + pageSize + "";
//
//            logger.info("findActivityLogDetail sql={}", sql);
//            logger.info("findActivityLogDetail params={}", JsonUtil.toJson(paramList));
//
//            Object[] params = paramList.toArray();
//            pst = (ClickHousePreparedStatement) conn.prepareStatement(sql);
//            for (int i = 0; i < params.length; i++) {
//                pst.setObject(i + 1, params[i]);
//            }
//            resultSet = pst.executeQuery();
//            while (resultSet.next()) {
//                ActivityLogCommonDetail activityLogDetail = new ActivityLogCommonDetail();
//                int aid = resultSet.getInt("activityid");
//                long uid = resultSet.getLong("uid");
//                String detail = resultSet.getString("detail");
//                String tag = resultSet.getString("tag");
//                Timestamp timestamp = resultSet.getTimestamp("timestamp");
//                SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm:ss");
//
//                activityLogDetail.setStatId(uid);
//                UserLevelOneResultData userLevelOne = apiService.getUserLevelOne(uid);
//                if (userLevelOne != null) {
//                    activityLogDetail.setShowId(userLevelOne.getShowid().longValue());
//                    activityLogDetail.setNickname(userLevelOne.getNickname());
//                } else {
//                    activityLogDetail.setShowId(0L);
//                    activityLogDetail.setNickname("");
//                }
//
//                String title = activityRepository.findById((long) aid).get().getTitle();
//                activityLogDetail.setAid(aid);
//                activityLogDetail.setTitle(title);
//                activityLogDetail.setTagName(tag);
//                activityLogDetail.setDateline(format.format(timestamp));
//                activityLogDetail.setDetail(detail);
//
//                ActivityLogSpecialDetail activityLogSpecialDetail = JsonUtil.fromJson(detail, ActivityLogSpecialDetail.class);
//                String category = activityLogSpecialDetail.getCategory();
//                Integer count = activityLogSpecialDetail.getCount();
//                String descr = activityLogSpecialDetail.getDescr();
//                String propType = activityLogSpecialDetail.getPropType();
//                Integer propId = activityLogSpecialDetail.getPropId();
//                Integer giftId = activityLogSpecialDetail.getGiftId();
//                Integer amount = activityLogSpecialDetail.getAmount();
//                Integer groupId = activityLogSpecialDetail.getGroupId();
//                String type = activityLogSpecialDetail.getType();
//                Integer grade = activityLogSpecialDetail.getGrade();
//                Integer isWin = activityLogSpecialDetail.getIsWin();
//                Integer pkId = activityLogSpecialDetail.getPkId();
//                // 猫狗和翻翻的轮次
//                Integer round = activityLogSpecialDetail.getRound();
//                // 这是个JSON数组 用于存放兑换前的礼物信息
//                List<ConsumedGift> consumedGifts = activityLogSpecialDetail.getConsumedGifts();
//                if (CollectionUtils.isNotEmpty(consumedGifts)) {
//                    for (ConsumedGift consumedGift : consumedGifts) {
//                        consumedGift.setGiftName(splicingDataUtils.selectGiftName(consumedGift.getGiftId()));
//                        consumedGift.setGiftPrice(splicingDataUtils.selectGiftPrice(consumedGift.getGiftId()));
//                    }
//                }
//                activityLogDetail.setCategory(category);
//                activityLogDetail.setCount(count);
//                activityLogDetail.setPropType(propType);
//                activityLogDetail.setPropId(propId);
//                activityLogDetail.setPropName(splicingDataUtils.selectPropName(propType, propId));
//                activityLogDetail.setDescr(descr);
//                activityLogDetail.setGiftId(giftId);
//                activityLogDetail.setGiftName(splicingDataUtils.selectGiftName(giftId));
//                activityLogDetail.setGiftPrice(splicingDataUtils.selectGiftPrice(giftId));
//                activityLogDetail.setAmount(amount);
//                activityLogDetail.setGroupId(groupId);
//                activityLogDetail.setGroupName(splicingDataUtils.selectGroupName(groupId));
//                activityLogDetail.setType(type);
//                activityLogDetail.setTypeName(splicingDataUtils.selectTypeName(category, type));
//                activityLogDetail.setGrade(grade);
//                activityLogDetail.setGradeName(splicingDataUtils.selectGradeName(category, grade));
//                activityLogDetail.setIsWin(isWin);
//                activityLogDetail.setIsWinName(splicingDataUtils.selectIsWinName(isWin));
//                activityLogDetail.setPkId(pkId);
//                activityLogDetail.setConsumedGifts(splicingDataUtils.selectConsumedGifts(consumedGifts));
//                activityLogDetail.setRound(round);
//
//                list.add(activityLogDetail);
//
//            }
//        } catch (SQLException e) {
//            logger.error("DashBoardService findTagOnGoingActivity errMsg={}", e.getMessage());
//        } finally {
//            clickHouseUtils.close(pst, resultSet, conn);
//        }
//        return list;
//    }
//
//    /**
//     * 接口 赔率
//     */
//    public List<PriceForUser> priceForActivity(ActivityLogQuery activityLogQuery) {
//        PriceForUser priceForUser = new PriceForUser();
//        Long showId = activityLogQuery.getShowId();
//        UserLevelOneResultData userLevelOne = apiService.getUserLevelOneByShowId(showId.intValue());
//        if (userLevelOne != null) {
//            priceForUser.setShowId(userLevelOne.getShowid().longValue());
//            priceForUser.setNickname(userLevelOne.getNickname());
//        } else {
//            priceForUser.setShowId(0L);
//            priceForUser.setNickname("");
//        }
//        if (activityLogQuery.getAid().equals(205)) {
//            // 大抢购单独处理
//            priceForUser.setSpend(priceDataUtils.spend(activityLogQuery, ""));
//            priceForUser.setPrice(priceDataUtils.price(activityLogQuery, ""));
//            priceForUser.setLowSpend(priceDataUtils.spend(activityLogQuery, "angle"));
//            priceForUser.setLowPrice(priceDataUtils.price(activityLogQuery, "AngleLiveReward"));
//            priceForUser.setHighSpend(priceDataUtils.spend(activityLogQuery, "pingou"));
//            priceForUser.setHighPrice(priceDataUtils.price(activityLogQuery, "PingouReward"));
//        } else if (activityLogQuery.getAid().equals(prop.catDogAid)) {
//            // 猫狗猜拳单独处理
//            priceForUser.setSpend(priceDataUtils.spendCatDogPK(activityLogQuery, 0));
//            priceForUser.setPrice(priceDataUtils.priceCatDogPK(activityLogQuery, 0));
//            priceForUser.setLowSpend(priceDataUtils.spendCatDogPK(activityLogQuery, 3));
//            priceForUser.setLowPrice(priceDataUtils.priceCatDogPK(activityLogQuery, 3));
//            priceForUser.setHighSpend(priceDataUtils.spendCatDogPK(activityLogQuery, 9));
//            priceForUser.setHighPrice(priceDataUtils.priceCatDogPK(activityLogQuery, 9));
//        } else {
//            priceForUser.setSpend(priceDataUtils.spend(activityLogQuery, 0));
//            priceForUser.setPrice(priceDataUtils.price(activityLogQuery, 0));
//            priceForUser.setLowSpend(priceDataUtils.spend(activityLogQuery, 1));
//            priceForUser.setLowPrice(priceDataUtils.price(activityLogQuery, 1));
//            priceForUser.setHighSpend(priceDataUtils.spend(activityLogQuery, 10));
//            priceForUser.setHighPrice(priceDataUtils.price(activityLogQuery, 10));
//        }
//        return Collections.singletonList(priceForUser);
//    }
//
//    /**
//     * 接口 PK 汇总
//     */
//    List<SummaryPK> summaryPKForActivity(ActivityLogQuery activityLogQuery) {
//        SummaryPK summaryPK = new SummaryPK();
//        Long showId = activityLogQuery.getShowId();
//        if (showId == null || showId == 0) {
//            summaryPK.setShowId(0L);
//            summaryPK.setNickname("");
//        } else {
//            UserLevelOneResultData userLevelOne = apiService.getUserLevelOneByShowId(showId.intValue());
//            if (userLevelOne != null) {
//                summaryPK.setShowId(userLevelOne.getShowid().longValue());
//                summaryPK.setNickname(userLevelOne.getNickname());
//            }
//        }
//        Integer aid = activityLogQuery.getAid();
//        Connection conn = clickHouseUtils.connection();
//        ResultSet resultSet = null;
//        ClickHousePreparedStatement pst = null;
//        try {
//            List<Object> paramList = new ArrayList<>();
//            // 花费
//            String sql = "select visitParamExtractInt(detail , 'grade') grade,visitParamExtractInt(detail , 'isWin') isWin,count(visitParamExtractInt(detail , 'isWin')) `count` from activity_trace_log where tag = 'ActivityPkLog'";
//            sql = sqlUtils.boundCommonCondition(sql, paramList, activityLogQuery);
//            sql += " group by visitParamExtractInt(detail , 'grade'),visitParamExtractInt(detail , 'isWin')";
//            Object[] params = paramList.toArray();
//            pst = (ClickHousePreparedStatement) conn.prepareStatement(sql);
//            for (int i = 0; i < params.length; i++) {
//                pst.setObject(i + 1, params[i]);
//            }
//            resultSet = pst.executeQuery();
//            List<SummaryPKDetail> summaryPKDetails = new ArrayList<>();
//            while (resultSet.next()) {
//                SummaryPKDetail summaryPKDetail = new SummaryPKDetail();
//                int grade = resultSet.getInt("grade");
//                summaryPKDetail.setGrade(grade);
//                Integer isWin = resultSet.getInt("isWin");
//                summaryPKDetail.setIsWin(isWin);
//                long count = resultSet.getLong("count");
//                summaryPKDetail.setCount((int) count);
//                summaryPKDetails.add(summaryPKDetail);
//            }
//            Map<Integer, List<SummaryPKDetail>> gradeMap = summaryPKDetails.stream().collect(Collectors.groupingBy(SummaryPKDetail::getGrade));
//            List<SummaryGradeDetail> summaryGradeDetails = new ArrayList<>();
//            gradeMap.forEach((grade, detail) -> {
//                SummaryGradeDetail summaryGradeDetail = new SummaryGradeDetail();
//                summaryGradeDetail.setGrade(grade);
//                if (aid.equals(prop.summaryForAidSet.get(0))) {
//                    summaryGradeDetail.setGradeName(splicingDataUtils.selectGradeName("startQQ3", grade));
//                } else if (aid.equals(prop.summaryForAidSet.get(1))) {
//                    summaryGradeDetail.setGradeName(splicingDataUtils.selectGradeName("startQQ", grade));
//                } else if (aid.equals(prop.summaryForAidSet.get(2))) {
//                    summaryGradeDetail.setGradeName(splicingDataUtils.selectGradeName("startQQ5", grade));
//                }
//                List<SummaryWinDetail> summaryWinDetails = new ArrayList<>();
//                for (SummaryPKDetail summaryPKDetail : detail) {
//                    SummaryWinDetail summaryWinDetail = new SummaryWinDetail();
//                    Integer count = summaryPKDetail.getCount();
//                    Integer isWin = summaryPKDetail.getIsWin();
//                    summaryWinDetail.setIsWin(isWin);
//                    summaryWinDetail.setCount(count);
//                    summaryWinDetail.setIsWinName(splicingDataUtils.selectIsWinName(isWin));
//                    summaryWinDetails.add(summaryWinDetail);
//                }
//                // 补充默认值
//                List<Integer> winList = CollectionUtils.newArrayList(0, 1, -1);
//                Map<Integer, List<SummaryWinDetail>> winMap = summaryWinDetails.stream().collect(Collectors.groupingBy(SummaryWinDetail::getIsWin));
//                Set<Integer> isWinSet = winMap.keySet();
//                for (Integer isWin : winList) {
//                    if (!isWinSet.contains(isWin)) {
//                        SummaryWinDetail summaryWinDetail = new SummaryWinDetail();
//                        summaryWinDetail.setIsWin(isWin);
//                        summaryWinDetail.setCount(0);
//                        summaryWinDetail.setIsWinName(splicingDataUtils.selectIsWinName(isWin));
//                        summaryWinDetails.add(summaryWinDetail);
//                    }
//                }
//                summaryGradeDetail.setSummaryWinDetails(summaryWinDetails);
//
//                summaryGradeDetails.add(summaryGradeDetail);
//            });
//            summaryPK.setSummaryGradeDetails(summaryGradeDetails);
//        } catch (SQLException e) {
//            logger.error("DashBoardService summaryPKForActivity errMsg={}", e.getMessage());
//        } finally {
//            clickHouseUtils.close(pst, resultSet, conn);
//        }
//        return Collections.singletonList(summaryPK);
//    }
//
//    /**
//     * 接口 猫狗猜拳明细
//     */
//    List<CatDogPK> catDogPKDetail(ActivityLogQuery activityLogQuery) {
//        return priceDataUtils.catDogPKDetail(activityLogQuery);
//    }
//
//    /**
//     * 接口 用户的基本信息 和是否能参加该活动
//     */
//    public List<UserDetail> findUserDetail(Integer aid, Long showId) {
//        UserDetail userDetail = new UserDetail();
//        UserLevelOneResultData userInfo = apiService.getUserLevelOneByShowId(showId.intValue());
//        if (userInfo != null){
//            userDetail = splicingDataUtils.selectUserDetail(userDetail, userInfo);
//
//            boolean isUser = activityExtraService.getActivityInd(userInfo.getUid(), userInfo.getProfileprogress(), aid.longValue());
//            userDetail.setIsUser(isUser ? "是" : "否");
//
//            userDetail.setUid(userInfo.getUid());
//        }
//        return Collections.singletonList(userDetail);
//    }
//
//    /**
//     * 接口 当前活动用户的白名单和黑名单
//     */
//    public List<BlackWhiteUsers> findBlackWhiteUsers(Integer aid) {
//        String blackAidUserKey = String.format("activity:%s:indBlackUsers", aid);
//        String whiteAidUserKey = String.format("activity:%s:indWhiteUsers", aid);
//
//        BlackWhiteUsers blackWhiteUsers = new BlackWhiteUsers();
//        blackWhiteUsers.setBlackUsers(splicingDataUtils.selectUsers(blackAidUserKey));
//        blackWhiteUsers.setWhiteUsers(splicingDataUtils.selectUsers(whiteAidUserKey));
//
//        return Collections.singletonList(blackWhiteUsers);
//    }
//}
